package com.lwh.Test;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.lwh.DTO.DiagsisDTO;

/**
 * @author wanhua.li
 * @version 1.0
 * @description:诊断测试类
 * @date 2023/1/6 17:54
 */
public class DiagsisTest {
    public static void main(String[] args) {
        // TODO: 2023/1/6 记得修改excel列名和DTO保持一致
        String fileName = "D:\\政策包\\床日sql\\精神类.xlsx" ;
        EasyExcel.read(fileName, DiagsisDTO.class,new AnalysisEventListener<DiagsisDTO>() {

            @Override
            public void invoke(DiagsisDTO diagsisDTO, AnalysisContext context) {
                String diagsisList = "insert into CONFIG.P_BEDDAY_DIAGNOSIS_MANAGEMENT(BEDDAY_TYPE_ID,DISEASE_CODE,DISEASE_NAME) values ( 32,'"+ diagsisDTO.getDiagsisCode()+"'"+",'"+diagsisDTO.getDiagsisName()+"')";
                System.out.println(diagsisList);
            }

            @Override
            public void doAfterAllAnalysed(AnalysisContext context) {

            }
        }).sheet().doRead();
    }
}
